//
//  BBDressFlowCell.m
//  BearSiX
//
//  Created by Tom on 16/3/28.
//  Copyright © 2016年 Tom. All rights reserved.
//

#import "BBDressFlowCell.h"

@implementation BBDressFlowCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{

    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {

        [self createUI];
        self.backgroundColor = [UIColor whiteColor];
    }
    return self;
}
-(void)createUI{

    self.backgroundColor = BACKCOLOR;
    self.flowStatus_l = [[UIImageView alloc]initWithFrame:CGRectMake(WINSIZEWIDTH/20, WINSIZEWIDTH/30, WINSIZEWIDTH/30, WINSIZEWIDTH/30)];
    self.flowStatus_l.image = [UIImage imageNamed:@"status_over_l"];
    
    self.flowStatusView = [[UIView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(self.flowStatus_l.frame), 0.5, WINSIZEWIDTH/2.6-CGRectGetMaxY(self.flowStatus_l.frame))];
    self.flowStatusView.backgroundColor = YDREDCOLOr;
    self.flowStatusView.centerX = self.flowStatus_l.centerX;
    self.flowType = [[UILabel alloc]initWithFrame:CGRectMake(WINSIZEWIDTH/7, WINSIZEWIDTH/60, WINSIZEWIDTH/2, WINSIZEWIDTH/12)];
    self.flowType.text = @"挑选";
    self.flowType.font = [UIFont systemFontOfSize:WINSIZEWIDTH/22];
    self.flowType.textColor = [UIColor blackColor];
    
    self.flowStatus_r = [[UIImageView alloc]initWithFrame:CGRectMake(WINSIZEWIDTH-self.flowType.height-self.flowStatus_l.x, self.flowType.y, self.flowType.height, self.flowType.height/1.5)];
    self.flowStatus_r.centerY = self.flowType.centerY;
    self.flowStatus_r.image = [UIImage imageNamed:@"status_over_r"];
    self.flowStatus_r.contentMode = UIViewContentModeScaleAspectFit;
    
    CGRect leftFrame = CGRectMake(self.flowType.x, CGRectGetMaxY(self.flowType.frame)+self.flowType.height, WINSIZEWIDTH, self.flowType.height);
    UILabel *personLabel = [[UILabel alloc]init];
    personLabel.textColor = [UIColor colorWithHexString:@"6e6f71"];
    personLabel.font = [UIFont systemFontOfSize:WINSIZEWIDTH/22];
    personLabel.text = @"服 务 人 ：";
    personLabel.frame = [personLabel textRectForBounds:leftFrame limitedToNumberOfLines:1];
    personLabel.height = self.flowType.height;
    
    UILabel *dateLabel = [[UILabel alloc]init];
    dateLabel.text = @"服务时间：";
    dateLabel.textColor = personLabel.textColor;
    dateLabel.font = personLabel.font;
    dateLabel.frame = [dateLabel textRectForBounds:leftFrame limitedToNumberOfLines:0];
    dateLabel.y = CGRectGetMaxY(personLabel.frame);
    dateLabel.height = self.flowType.height;
    
    self.flowPerson = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(personLabel.frame), personLabel.y, WINSIZEWIDTH/2, self.flowType.height)];
    self.flowPerson.textColor = self.flowType.textColor;
    self.flowPerson.font = self.flowType.font;
    self.flowPerson.text = @"李晓月";
    
    self.flowDate = [[UILabel alloc]initWithFrame:CGRectMake(self.flowPerson.x, CGRectGetMaxY(self.flowPerson.frame), WINSIZEWIDTH/2, self.flowPerson.height)];
    self.flowDate.text = @"2015-02-14";
    self.flowDate.textColor = self.flowPerson.textColor;
    self.flowDate.font = self.flowPerson.font;
    
    self.buView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 0.5, CGRectGetMaxY(self.flowStatus_l.frame)-self.flowStatus_l.height/1.5)];
    self.buView.backgroundColor = self.flowStatusView.backgroundColor;
    self.buView.centerX = self.flowStatusView.centerX;
    [self.contentView addSubview:self.buView];
    [self.contentView addSubview:self.flowStatus_l];
    [self.contentView addSubview:self.flowStatusView];
    [self.contentView addSubview:self.flowType];
    [self.contentView addSubview:self.flowStatus_r];
    [self.contentView addSubview:personLabel];
    [self.contentView addSubview:dateLabel];
    [self.contentView addSubview:self.flowPerson];
    [self.contentView addSubview:self.flowDate];
    
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
